import Vue from 'vue'
import App from './App.vue'
import router from './router'
// import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css'
import ZkTable from 'vue-table-with-tree-grid'
import moment from 'moment'
import VueQuillEditor from 'vue-quill-editor'

// 导入进度条的包
import nprogress from 'nprogress'
// import 'nprogress/nprogress.css'

// import 'quill/dist/quill.core.css'
// import 'quill/dist/quill.snow.css'
// import 'quill/dist/quill.bubble.css'

// 导入全局样式css
import './assets/css/global.css'
// 导入字体图标
import './assets/fonts/iconfont.css'

import axios from 'axios'

Vue.use(VueQuillEditor)
// Vue.use(ElementUI)
Vue.component('tree-table', ZkTable)
// 过滤器
Vue.filter('dateFormat', function (val, format) {
  return moment(val).format(format)
})
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
// 请求拦截器
axios.interceptors.request.use(config => {
  // 进度条显示
  nprogress.start()
  config.headers.Authorization = sessionStorage.getItem('token')
  return config
}, error => {
// Do something with request error
  return Promise.reject(error)
})
// 响应拦截器
axios.interceptors.response.use(config => {
  // 进度条隐藏
  nprogress.done()
  return config
}, error => {
// Do something with request error
  return Promise.reject(error)
})
Vue.prototype.$http = axios

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
